<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ page import = "com.project.model.Food"%>
<%@ page import = "com.project.control.FoodControl"%>
<%@page import="com.project.util.ParamUtil"%>
<%@ page import = "com.project.control.DateControl"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck"%>

<html>
  <head>
    <title>修改动态</title> 
      <link href="../../../resources/css/admin/pages_member.css" rel="stylesheet" type="text/css"/>
  </head>
  <body>
  		<%
			request.setCharacterEncoding("UTF-8");
			int id = Integer.parseInt(request.getParameter("id"));
			FoodControl hc = new FoodControl();
			Food food = new Food();
			DateControl dc = new DateControl();
			String addtime = dc.Date();
			food = hc.getOneFoodById(id);
			String content = food.getContent();
			request.setAttribute("content1", content);
			System.out.println(request.getParameter("content1"));
			String href = "food_update.jsp";
		%>
  
  		
  
  	 <script type="text/javascript">
	 function checkform(form){
	     if(form.content.value==""){
	  		alert("内容不能为空!");
	  		window.location.href="<%=href%>";
	  		form.content.focus();
	  		return false;
	  		}
	  	
	  	}
  </script>
  
   <div>
   <form name="f" action="food_updatedo.jsp?id=<%=id%>" method="post"onSubmit="return checkform(this);">
   <table width="100%" border="0" cellpadding="0" cellspacing="0" class="forms">
   <tr>
   <td width="150" class="items">标题</td>
	<td class="left"><label for="textfield"></label>
	<input name="title" type="text" id="title" value="<%=food.getTitle()%>"/></td>
	</tr>
	<tr>
	<td width="150" class="items">作者</td>
	<td class="left"><label for="textfield"></label>
	<input type="text" id="editor" name="editor" value="<%=food.getEditor()%>"/>
	</td>
	</tr>

	<tr>
	<td>转贴自：</td>
	<td><input type="text" name="original" value="<%=food.getOriginal()%>" /></td>
	</tr>

	<tr>
	<td width="150" class="items">发布时间</td>
	<td class="left"><label for="textfield"></label>
		<input type="text" id="addtime" readonly="true" name="addtime" value="<%=addtime%>">

    </td>
    </tr>

	<tr>
	<td class="items">类别</td>
	<td class="left"><label for="textfield"></label>
	<select name=type>
	<option selected="selected"></option>
	<option value=0 selected>东师美食</option>
	<option value=1>美食搭配</option>
	<option value=2>食物禁忌</option>
	</select>
	</td>
	</tr>

    <tr>
    <td>内容</td>
    <td>
			<fck:editor id="content1" basePath="/dongshilife1/fckeditor/" height="450"
				width="900" skinPath="/dongshilife1/fckeditor/editor/skins/office2003/"
				toolbarSet="Default"
				linkBrowserURL="/dongshilife1/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
				linkUploadURL="/dongshilife1/fckeditor/editor/filemanager/upload/simpleuploader?Type=File">
				<%out.println(food.getContent());%>
			</fck:editor>
	</td>
	</tr>
	
	<tr>
	<td><input type="submit" id="submit" value="提交"/>
	<input type="reset" value="取消" onClick="window.location.href='food.jsp'"/></td>
	</tr>
</form>

  </body>
</html>
